﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Guline.Web.Central.Controllers;
namespace Guline.Web.Central.Areas.Api.Controllers
{
    public class AppController : BaseController
    {
        public ActionResult GetApps(string username)
        {
            var apps = from m in db.CApps where m.Account.UserName == username select new { m.Accesskey, m.CreateDate, m.Description, m.ID, m.Name,m.DeviceID,m.Device.AndroidID };
            if (apps.Count() > 0)
            {
                return Json(new { success = true, info = new { count = apps.Count() }, data = apps }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { success = false, data = new { count = 0 } }, JsonRequestBehavior.AllowGet);
            }
        }
    }
}
